<template>
    <div v-if="content && content.books.length>0">
        <div class="nav row">
            <div class="row">
                <text class="text-main text">{{content.title}}</text>
            </div>
            <div class="row history-title-left" @click="goToMore(content._id, content.title)">
                <text class="look-more text">查看更多</text>
                <image class="right-icon text" :src="left_icon"></image>
            </div>
        </div>
        <div class="scroller book-wrap row" v-for="(item,index) in content.books" @click="goToBook(item._id)"
             v-if="item">
            <book-item :item="item"></book-item>
        </div>
    </div>
</template>

<script>
    import BookList from '../search/BookList'
    import BookItem from '../book/BookItem'
    import {left_icon} from '../../baseConfig'

    export default {
        components: {BookList, BookItem},
        name: "c-ity-item",
        props: {
            content: {
                type: Object,
                default: undefined,
            },
            contentHeight: {
                type: Number,
                default: 700,
            }
        },
        data() {
            return {
                left_icon: left_icon
            }
        },
        methods: {
            goToMore(moreId, title) {
                this.$router.push({name: 'storeMore', query: {moreId: moreId, title: title}})
            },
            goToBook(_id) {
                this.$router.push({'name': 'bookInfo', query: {bookId: _id}});
            },
        }
    }
</script>

<style scoped>
    .row {
        flex-direction: row;
    }

    .nav {
        padding-left: 20px;
        padding-right: 20px;
        padding-top: 40px;
        padding-bottom: 40px;
        justify-content: space-between;
        align-items: stretch;
    }

    .text-main {
        font-size: 42px;
    }

    .history-title-left {
        justify-content: center;
        align-items: center;
    }

    .right-icon {
        width: 28px;
        height: 28px;
        margin-left: 10px;
    }

    .image {
        width: 700px;
        height: 285px;
    }

    .slider {
        margin-top: 25px;
        margin-left: 25px;
        width: 700px;
        height: 700px;
        border-width: 2px;
        border-style: solid;
        border-color: #41B883;
    }

    .frame {
        width: 700px;
        height: 700px;
        position: relative;
    }
    .row {
        flex-direction: row;
    }

    .book-wrap {
        padding: 20px;
        font-size: 12px;
    }
</style>